#include"StringPool.h"
#include"variable.h"
#include"DependencyWriter.h"
#include"MSTWriter.h"
#include"Util.h"

MSTWriter::MSTWriter() : DependencyWriter(){};

MSTWriter::MSTWriter(bool labeled, bool hasEnd){
	this->labeled = labeled;
	this->hasEnd = hasEnd;
}

void MSTWriter::write(vector<string*> &forms, vector<string*> &pos, vector<string*> &labs, vector<int> &heads){
	string* str = Util::join(forms, '\t');
	str->append("\n");
	fputs(str->c_str(), writer);
	pool->push_back(str);
	str = Util::join(pos, '\t');
	str->append("\n");
	fputs(str->c_str(), writer);
	pool->push_back(str);
	if(labeled){
		str = Util::join(labs, '\t');
		str->append("\n");
		fputs(str->c_str(), writer);
		pool->push_back(str);
	}
	str = Util::join(heads, '\t');
	str->append("\n\n");
	fputs(str->c_str(), writer);
	pool->push_back(str);
}
